# Maintainer: Andrew Sun <adsun701@gmail.com>

_realname=more-itertools
pkgbase=mingw-w64-python2-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=5.0.0
pkgrel=1
epoch=1
pkgdesc="More routines for operating on iterables, beyond itertools (mingw-w64)"
arch=('any')
url="https://github.com/erikrose/more-itertools"
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-python2"
         "${MINGW_PACKAGE_PREFIX}-python2-six")
makedepends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools")
options=('staticlibs' 'strip' '!debug')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/erikrose/more-itertools/archive/${pkgver}.tar.gz")
sha256sums=('a2dd59cdb7287d738b3c745558f0812b69b519cda21726b180b09d9d68d8b461')

prepare() {
  cd "${srcdir}"

}

build() {
  cd "${srcdir}"

  rm -rf python2-build-${CARCH}
  cp -r "${_realname}-${pkgver}" "python2-build-${CARCH}"
  cd "${srcdir}/python2-build-${CARCH}"

  ${MINGW_PREFIX}/bin/python2 setup.py build
}

package() {
  cd "${srcdir}/python2-build-${CARCH}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 LICENSE "${pkgdir}"${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

